<?php
/**
 * 发送短信接口
 * @author zouhao
 */
class Sms{
	private $regcode='WSXX-CRM-0100-OBPMOK';
	private $pwd='27985622';
	private $url='http://211.99.191.148/mms/services/info?wsdl';
	private $suffix='';
	public function register(){
		$url='http://sms.ycweisi.com/zqhdServer/reg.jsp';
		$data['regcode']=$this->regcode;
		$data['pwd']=md5($this->pwd);
		$data['key']='077be2c9df20b1c08a3d7df3d60f837d';
		$data['CNAME']=iconv("UTF-8", "GBK", '宜昌三森教育咨询有限公司');
		$data['ENAME']='Yichang Sansen';
		$data['CSNAME']=iconv("UTF-8", "GBK", '三森');
		$data['ESNAME']='Sansen';
		$data['ENTERPRISETYPEID']='01';
		$data['ADDR']=iconv("UTF-8", "GBK",'湖北省宜昌市夷陵大道');
		$data['LINKTEL']='13197322336';
		$data['LINKMAN']='';
		$data['EMAIL']='admin@kcwzh.com';
		$data['FAX']='13197322336';
		$data['POSTCODE']='443000';
		$data['MOBILETEL']='13197322336';
		$rs=curl_get($url,$data);
		$xml=xml_to_object($rs);
		if($xml->result==0){
			return true;
		}else{
			return $xml->result;
		}
	}
	public function sendSms($phone,$content){
		$url='http://sms.ycweisi.com/zqhdServer/sendSMS.jsp';
		$data['regcode']=$this->regcode;
		$data['pwd']=md5($this->pwd);
		$data['phone']=$phone;
		$data['content']=iconv("UTF-8", "GBK",$content.$this->suffix);
		$data['extnum']=11;
		$data['level']=1;
		$data['schtime']='null';
		$data['reportflag']=1;
		$data['url']='';
		$data['smstype']=0;
		$data['key']='05acd56dbb53ee2a62c2afd344eafcba';
		$rs=curl_get($url,$data);
		$xml=xml_to_object($rs);
		if($xml->result==0){
			return true;
		}else{
			return $xml->result;
		}
	}
	public function surplus(){
		$url='http://sms.ycweisi.com/zqhdServer/getbalance.jsp';
		$data['regcode']=$this->regcode;
		$data['pwd']=md5($this->pwd);
		$data['key']='077be2c9df20b1c08a3d7df3d60f837d';
		$rs=curl_get($url,$data);
		$xml=xml_to_object($rs);
		return $xml->result;
	}
}